package db

import (
	"d-serv-go/server/core/bean"
)

var UserMgr UserMgrInterface

type UserMgrInterface interface {

	GetUserStateByToken(token string) *bean.UserStateBean

	GetUser(userCode string) (*UserBean, error)

	GetUserState(userCode string) *bean.UserStateBean

	SaveUserState(state *bean.UserStateBean, checkExists bool) bool

	GetUserByLoginName(loginName string, cmpy string) (*UserBean,error)

	SetTokenUserStateCache(token string, state *bean.UserStateBean)

	SetUserTokenCache(userCode string, state *bean.UserStateBean)

	GetCacheVarMap(userCode string) map[string]interface{}

	SetCacheVarMap(userCode string, vars map[string]interface{})

	SetCacheMenuList(userCode string, tree []*bean.Bean)

	GetCacheMenuList(userCode string) []*bean.Bean

	GetCacheUser(userCode string) *UserBean

	RemoveTokenUserStateCache(token string)
}

var OrgMgr OrgInterface

type OrgInterface interface {

	CheckServAuth(servDef bean.Bean) bool

	GetCmpy(cmpyCode string) *bean.CmpyBean

	GetDeptNames(dept *bean.DeptBean) string

	GetDept(deptCode string) *bean.DeptBean

	GetFullDeptNames(deptCode string) string

	GetODeptBean(deptCode string) *bean.DeptBean

	GetTDeptBean(deptCode string) *bean.DeptBean

	GetParentDeptBean(deptCode string) *bean.DeptBean

	GetCmpyBean(cmpyCode string) *bean.CmpyBean

}
